<?php

class dbaCMSUserComment
{
    
    var $dba;

    function dbaCMSUserComment(& $dba)
    {
        $this->dba = & $dba;
    }
    
    function getComments ($doc_id, $lang_id)
    {
        $sth = $this->dba->query("select * from ".$this->dba->tableforwarder
            ."_cmsUserComment where doc_id = $doc_id and lang = $lang_id order by built_date desc");
        if (is_object($sth))
        {
            $rows = $sth->fetch_rows_array();
            $sth->free();
            return $rows;
        }
    }
    
    function addComment ($doc_id, $lang_id, $user_name, $user_email, $title, $comment)
    {
        $this->dba->query("insert into ".$this->dba->tableforwarder
            ."_cmsUserComment (doc_id, lang, user_name, user_email, title, comment, built_date)"
            ." values (". (int) $doc_id.", ". (int) $lang_id.", "
            .$this->dba->quote($user_name).", ".$this->dba->quote($user_email)
            .", ".$this->dba->quote($title).", "
            .$this->dba->quote($comment).", ".time().")");
    }

}

?>